package chapter13;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author : DuJiabao
 * @Date : 2021/2/24 17:44
 * @Project : thinking_in_java
 * @File : null.java
 * @Desc :
 */
public class ResetTest {
  public static void main(String[] args) {
    Matcher m = Pattern.compile("[frb][aiu][gx]").matcher("fix the rug with bags");
    while (m.find()) {
      System.out.println(m.group() + " ");
    }

    System.out.println("******************reset*********************");
    m.reset(); // 重置
    while (m.find()) {
      System.out.println(m.group() + " ");
    }

    System.out.println("******************reset*********************");
    m.reset("bags the fix with rug"); // 重置
    while (m.find()) {
      System.out.println(m.group() + " ");
    }
  }
}
